package com.sky.mapper;

import com.sky.dto.OrdersCancelDTO;
import com.sky.dto.OrdersConfirmDTO;
import com.sky.dto.OrdersPageQueryDTO;
import com.sky.dto.OrdersRejectionDTO;
import com.sky.entity.Orders;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.time.LocalDateTime;
import java.util.List;

@Mapper
public interface OrdersMapper {
    void add(Orders orders);
    @Select("select * from orders where number = #{orderNumber}")
    Orders getByNumber(String orderNumber);

    /**
     * 修改订单信息
     * @param orders
     */
    void update(Orders orders);

    List<Orders> page(OrdersPageQueryDTO ordersPageQueryDTO);

    Orders getById(Long id);

    void cancel(Long id);

    void confirm(OrdersConfirmDTO ordersConfirmDTO);
    void rejection(OrdersRejectionDTO ordersRejectionDTO);
    void delivery(Long id, LocalDateTime deliveryTime);

    void complete(Long id, LocalDateTime completeTime);

    void admincancel(OrdersCancelDTO ordersCancelDTO, LocalDateTime cancelTime);

    Integer countStatus(Integer toBeConfirmed);

    List<Orders> getByStatusAndOrderTime(Integer status, LocalDateTime time);
}
